'use strict';

/**
 * 门禁权限schema
 */
const mongoose = require('mongoose'), Schema = mongoose.Schema;
const Cons = require('../common/constants');

const guardSchema = new Schema({
    _id: {type: String}, //IPC编号
    g_st: {type: String}, //门禁开关控制器类型  0：华强货，1：地平线 暂时默认0
    g_sw: {type: String}, //门禁开关 10.64.33.198-5000-2:01
    g_ch: {type: String}, //订阅频道，从redis接受推送，实现门禁开启
    p_fr: {type: String, default: Cons.GUARG_TIME_FROM}, //开放时刻
    p_to: {type: String, default: Cons.GUARG_TIME_TO}, //开放时刻
    p_wk: [{
        week: String,
        value: Number
    }], //开放星期，0代表周六
    u_in: [{
        u_id: String
    }], //包含用户
    c_id: {type: String}, //创建者
    m_id: {type: String}, //更新者
}, {timestamps: {createdAt: 'c_at', updatedAt: 'm_at'}});

module.exports = mongoose.model('GuardModel', guardSchema, "guard");
